<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<html>

<head>

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>仪器共享</title>

<meta name="keywords" content="科研仪器，生命科学仪器，环境检测仪器，实验常用设备，分析仪器">

<meta name="description"
	content="中国领先的科研仪器共享平台，让您快速找到各种类型的科学研究仪器。提升闲置仪器利用率，产生更大科研价值。涵盖：生命科学仪器、环境检测仪器、实验常用设备、分析仪器、仪表、物性测试、测量/计量仪器、在线及过程控制仪器。

">
<!--<link rel="stylesheet" href="new_css/header_footer.css?t=1">-->
<link rel="stylesheet" href="new_css/publishService.css">
<link rel="stylesheet" href="css/new_style.css">
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/common.css">
<script src="new_js/jquery-1.11.3.js"></script>
<style>
.mainList .content .right .title {
	margin-left: 30px;
}

.main-content-mid {
	/*margin-left: 40px;*/
	
}

.mainList .content {
	width: 100%;
	overflow: hidden;
	height: 100% !important;
}

.mainList .content .right {
	height: 100% !important;
}

/*小箭头*/
.sun_item>.sun_item_div1:after, .sun_item>.sun_item_div1:before {
	border: solid transparent;
	content: '';
	height: 0;
	left: 100%;
	position: absolute;
	width: 0;
}

.sun_item>.sun_item_div1:before {
	border-width: 12px;
	border-left-color: rgba(196, 196, 196, 1);
	top: 75px;
}

.sun_item>.sun_item_div1:after {
	border-width: 10px;
	border-left-color: #fff;
	top: 77px;
}

/*goods-comm-stars style*/
.goods-comm {
	height: 41px;
	position: relative;
	z-index: 7;
}

.goods-comm-stars {
	line-height: 25px;
	height: 41px;
	position: absolute;
	top: 0px;
	left: 0;
	width: 400px;
}

.goods-comm-stars .star_l {
	float: left;
	display: inline-block;
	margin-right: 5px;
	display: inline;
}

.goods-comm-stars .star_choose {
	float: left;
	display: inline-block;
}

.goods-comm {
	height: 41px;
	position: relative;
	z-index: 7;
}

.goods-comm-stars1 {
	line-height: 25px;
	height: 41px;
	position: absolute;
	top: 0px;
	left: 0;
	width: 400px;
}

.goods-comm-stars1 .star_l {
	float: left;
	display: inline-block;
	margin-right: 5px;
	display: inline;
}

.goods-comm-stars1 .star_choose {
	float: left;
	display: inline-block;
}
/* rater star */
.rater-star {
	position: relative;
	list-style: none;
	margin: 0;
	padding: 0;
	background-repeat: repeat-x;
	background-position: left top;
	float: left;
}

.rater-star-item, .rater-star-item-current {
	position: absolute;
	top: 0;
	left: 0;
	background-repeat: repeat-x;
}

.rater-star-item-hover {
	position: absolute;
	top: 0;
	left: 0;
	background-repeat: repeat-x;
	z-index: 999 !important;
}

.rater-star-item {
	background-position: -100% -100%;
}

.rater-star-item-hover {
	background-position: 0 -48px;
	cursor: pointer;
}

.rater-star-item-current {
	background-position: 0 -48px;
	cursor: pointer;
}

.rater-star-item-current.rater-star-happy {
	background-position: 0 -25px;
}

.rater-star-item-hover.rater-star-happy {
	background-position: 0 -25px;
}

.rater-star-item-current.rater-star-full {
	background-position: 0 -72px;
}
/* popinfo */
.popinfo {
	display: none;
	position: absolute;
	top: 30px;
	background: url(images/infobox-bg.gif) no-repeat;
	padding-top: 8px;
	width: 192px;
	margin-left: -14px;
}

.popinfo .info-box {
	border: 1px solid #f00;
	border-top: 0;
	padding: 0 5px;
	color: #F60;
	background: #FFF;
}

.popinfo .info-box div {
	color: #333;
}

.rater-click-tips {
	font: 12px/25px;
	color: #333;
	margin-left: 10px;
	background: url(images/infobox-bg-l.gif) no-repeat 0 0;
	width: 151px;
	height: 34px;
	padding-left: 16px;
	overflow: hidden;
}

.rater-click-tips span {
	display: block;
	background: #FFF9DD url(images/infobox-bg-l-r.gif) no-repeat 100% 0;
	height: 34px;
	line-height: 34px;
	padding-right: 5px;
}

.rater-star-item-tips {
	background: url(images/star-tips.gif) no-repeat 0 0;
	height: 41px;
	overflow: hidden;
}

.cur.rater-star-item-tips {
	display: block;
}

.rater-star-result {
	color: #FF6600;
	font-weight: bold;
	padding-left: 10px;
	float: left;
}

/*评论*/
.commentary {
	width: 935px;
	height: 402px;
	border: 1px solid #C4C4C4;
}

.commentary .buyer-evaluation {
	width: 467px;
	border-right: 1px solid #d2d2d2;
}

.commentary .buyer-evaluation .buyer-evaluation-title {
	height: 41px;
	line-height: 41px;
	margin: 8px auto;
	text-align: center;
	/*border-bottom: 1px solid #d2d2d2;*/
}

.commentary .buyer-evaluation .buyer-evaluation-title p {
	padding-bottom: 8px;
	border-bottom: 1px solid #d2d2d2;
	color: #1A1A1A;
	font-size: 16px;
	/**/
}

.buyer-evaluation-content ul li span {
	color: #FF8A00;
}

.mainList .content .right ul li label {
	width: 100px;
	display: inline-block;
	/*text-align: right;*/
	padding-right: 20px;
}

.mainList .content .right ul .item11 select {
	height: 54px;
	width: 477px;
}

.mainList .content .right ul .item4 textarea {
	width: 468px;
	height: 183px;
	vertical-align: middle;
}

.mainList .content .title {
	width: 100%;
	height: 47px;
	border-bottom: 1px solid #d3d3d3;
	line-height: 44px;
	font-size: 18px;
	color: #202020;
	margin: 20px auto;
}

.mainList .content .title-bot {
	width: 100%;
	height: 47px;
	line-height: 44px;
	font-size: 16px;
	color: #202020;
	margin: 20px 0px 20px 30px;
}

.mainList .content .title span {
	display: inline-block;
	height: 100%;
	border-bottom: 2px solid #ff8a00;
}

.sun_item>.sun_item_div2 {
	display: inline-block;
	float: left;
	width: 989px;
	height: 172px;
	padding: 0 60px;
	border: none;
	border-bottom: 1px solid rgba(196, 196, 196, 1);
	border-left: 1px solid rgba(196, 196, 196, 1);
}

.biaodan {
	margin-left: 30px;
}

.service-bar {
	width: 100%;
	max-width: 1198px;
	height: 36px;
	background-color: #EDEDED;
}

.service-bar ul li {
	display: inline-block;
	line-height: 36px;
	width: 560px;
	padding-left: 30px;
}

.service-left {
	/*width: 597px;*/
	width: 100%;
	height: 120px;
}

.service-item {
	/*width:800px;*/
	width: 96%;
	height: 100px;
	margin: 20px 0 20px 20px;
}

.service-item .service-item-img img {
	width: 90px;
	height: 90px;
	border: 1px solid #efefef;
	margin: 0px 20px 0px 10px;
}
/*字数限制*/
.service-item .service-item-content ul li {
	overflow: hidden; /*自动隐藏文字*/
	text-overflow: ellipsis; /*文字隐藏后添加省略号*/
	white-space: nowrap; /*强制不换行*/
	width: 57em; /*不允许出现半汉字截断*/
}

.service-item .service-item-content .money-color-style {
	color: #ED1717;
	font-size: 18px;
}

.main-content-mid {
	margin: 30px;
	/*width: 550px;*/
	width: 95%;
}
/*.main-content-mid ul li{*/
/*display: inline-block;*/
/*width: 270px;*/
/*}*/
/*.special{*/
/*display: block !important;*/
/*width: 500px !important;*/
/*}*/
a.clearfix.fr.commentary-btn {
	/* width: 151px; */
	/* height: 46px; */
	width: 190px;
	height: 64px;
	line-height: 64px;
	background-color: #ff8a00;
	text-align: center;
	color: #fff;
	font-size: 18px;
	/* float: left; */
	/* margin-left: 155px; */
	/* border-radius: 5px; */
}

.commentaryBtn.clearfix {
	width: 1200px;
	margin: 0 auto;
	text-align: center;
	margin-top: 30px;
}

a.commentaryBtnA {
	width: 190px;
	height: 64px;
	background: #F7843C;
	display: inline-block;
	line-height: 64px;
	font-size: 18px;
	color: #fff;
}

.dropdown-select {
	margin-top: 20px;
}

.commentary-person {
	height: 100%;
}

.commentary-item {
	height: 60px;
	margin-top: 20px;
}

.commentary-content {
	display: inline-block;
	overflow: hidden; /*自动隐藏文字*/
	text-overflow: ellipsis; /*文字隐藏后添加省略号*/
	white-space: nowrap; /*强制不换行*/
	width: 70em; /*不允许出现半汉字截断*/
	padding-left: 30px;
}

.commentary-time {
	display: block;
	text-align: right;
	padding-right: 20px;
	border-bottom: 1px solid #efefef;
}

label {
	margin: 0px;
	padding: 0px;
	border: 0px;
	width: 9% !important;
	padding-right: 0px !important;
}

.special {
	color: #FF8A00;
}

a.clearfix.fr.commentary-btn {
	/* width: 151px; */
	/* height: 46px; */
	width: 190px;
	height: 64px;
	line-height: 64px;
	background-color: #ff8a00;
	text-align: center;
	color: #fff;
	font-size: 18px;
	/* float: left; */
	/* margin-left: 155px; */
	/* border-radius: 5px; */
}

.commentaryBtn.clearfix {
	width: 1200px;
	margin: 0 auto;
	text-align: center;
	margin-top: 30px;
}

a.commentaryBtnA {
	width: 190px;
	height: 64px;
	background: #F7843C;
	display: inline-block;
	line-height: 64px;
	font-size: 18px;
	color: #fff;
	cursor: pointer;
}

a.commentaryBtnB {
	width: 188px;
	height: 62px;
	background: #fff;
	display: inline-block;
	line-height: 64px;
	font-size: 18px;
	color: #202020;
	margin-right: 10px;
	border: 1px solid #D3D3D3;
	cursor: pointer;
}

.dropdown-select {
	margin-top: 20px;
}

.commentary-person {
	height: 100%;
}

.commentary-item {
	height: 60px;
	margin-top: 20px;
}

.commentary-content {
	display: inline-block;
	overflow: hidden; /*自动隐藏文字*/
	text-overflow: ellipsis; /*文字隐藏后添加省略号*/
	white-space: nowrap; /*强制不换行*/
	width: 70em; /*不允许出现半汉字截断*/
	padding-left: 30px;
}

.commentary-time {
	display: block;
	text-align: right;
	padding-right: 20px;
	border-bottom: 1px solid #efefef;
}

label {
	margin: 0px;
	padding: 0px;
	border: 0px;
	width: 9% !important;
	padding-right: 0px !important;
}

.special {
	color: #FF8A00;
}
</style>
</head>
<body style="background:#fff;">
	<%@include file="/header3.jsp"%>
	<div class="mainList">
		<div class="bNav">
			您的位置：用户中心 > <span>订单详情</span>
		</div>
		<div class="content">
			<div class="right" id="contentDiv">
				<div class="title">
					<span>订单详情</span>
				</div>
			</div>
		</div>
	</div>

	<!--footer-->
	<%@include file="/footer.jsp"%>
	<script src="js/jquery-1.11.3.js"></script>
	<script src="js/common.js"></script>
	<script>
        $(function() {
            $('.service-good ul li').click(function(){

                // $(this).addClass('selected').siblings().removeClass('selected');
                //hasClass检查第一个元素是否包含 selected 类
                // console.log($(".service-good ul li").text())

				if($(this).hasClass('selected')){
                    $(this).removeClass('selected');
                    var index = $('.selected').text();
                    $("#textareaVal").html(index);
                }else{
                    $(this).addClass('selected');
                    var index = $('.selected').text();
                    $("#textareaVal").html(index);
                }
                // console.log($('.selected').text());
            });
        });

	</script>

	<script type="text/javascript">
		function GetUrlByParamName(name) {
  			 var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
 			 var URL =  decodeURI(window.location.search);
  			 var r = URL.substr(1).match(reg);
 			 if(r!=null){
 		        //decodeURI() 函数可对 encodeURI() 函数编码过的 URI 进行解码
 		         return decodeURI(r[2]);
  			 };
  		     return null;
 		};
 		
        $(function(){
        	
        	Date.prototype.Format = function (fmt) { //author: meizz 
			    var o = {
			        "M+": this.getMonth() + 1, //月份 
			        "d+": this.getDate(), //日 
			        "h+": this.getHours(), //小时 
			        "m+": this.getMinutes(), //分 
			        "s+": this.getSeconds(), //秒 
			        "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
			        "S": this.getMilliseconds() //毫秒 
			    };
			    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
			    for (var k in o)
			    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
			    return fmt;
			}
        
            $(".service-good ul li").click(function(){
                var m =""
                for(var i=0;i<$(".selected").text().length;i++){
                    if(i%5==0 && i!=0){
                        m =m+","+$(".selected").text()[i];
                    }else{
                        m =m+$(".selected").text()[i];
                    }
                }
                $("#textareaVal").html(m)
            })
           $.ajax({
					url :Server + "/orderRelevant/insOrderDetail",
					//url :"http://localhost/orderRelevant/insOrderDetail",
					data : {
						"oid":GetUrlByParamName("oid"),
						"uid":$("#useridoflogin").val()
						//"uid":"53954806924e497099791a551ae18412"
					},
					type : "POST",
					dataType: "JSON",
					success : function(data) {
						var insDiv='<div class="service-bar">'+
							'<ul>'+
								'<li>仪器名称</li>'+
							'</ul>'+
						'</div>'+
						'<div class="service-left">'+
							'<div class="service-item clearfix">'+
								'<div class="service-item-img fl">'+
									'<img src="'+data[0].insInfo.infoSrc+'">'+
								'</div>'+
								'<div class="service-item-content fl">'+
									'<ul>'+
										'<li>'+data[0].insInfo.chineseName+'</li>'+
										'<li>'+data[0].insInfo.serial+'</li>'+
										'<li class="money-color-style">¥'+data[0].insInfo.total+''+data[0].insInfo.unit+'</li>'+
									'</ul>'+
								'</div>'+
							'</div>'+
						'</div>';
					var samples="";
					var ids=new Array();
					ids.push("?");
					var flag=false;
					for(var j=0;j<data.length;j++){
						for(var i=0;i<ids.length;i++){
							//alert("ids[i]="+ids[i]+",data[j].Sample[0].id="+data[j].Sample[0].id)
							if(ids[i]==data[j].Sample[0].id){
								flag=false;
								break;
							}else{
								flag=true;
							}
						}
						if(flag==true){
							ids.push(data[j].Sample[0].id);
							samples=samples+data[j].Sample[0].centent+"、";
							flag=false;
						}
						if(ids.length=1){
							ids.push(data[j].Sample[0].id);
						}
					}	
					samples=samples.substring(0, samples.length - 1);
					var message="无";
					if(data[0].message!=undefined){
						message=message=data[0].message;
					}	
					var projectName=""; 
					if(data[0].orderappli!=undefined){
						if(data[0].orderappli.projectName!=null){
							projectName=data[0].orderappli.projectName
						} 
					}
					var appointDiv='<div class="service-bar clearfix">'+
						'<ul>'+
							'<li>预约信息</li>'+
						'</ul>'+
					'</div>'+
					'<div class="main-content-mid clearfix">'+
						'<ul>'+
							'<li><label>课题名称：</label> <span>'+projectName+'</span></li>'+
							'<li><label>测试样品：</label> <span>'+samples+'</span></li>'+
							'<li><label>预约日期：</label> <span id="date"></span></li>'+
							'<li><label>预约时间段：</label> <span id="time"></span></li>'+
							'<li><label>备注：</label> <span>'+message+'</span></li>'+
						'</ul>'+
					'</div>';
					var contactDiv='<div class="service-bar clearfix">'+
						'<ul>'+
							'<li>联系人信息</li>'+
						'</ul>'+
					'</div>'+
					'<div class="main-content-mid contacts-info clearfix">'+
						'<ul>'+
							'<li><label>联系人姓名：</label> <span>'+data[0].name+'</span></li>'+
							'<li><label>单位：</label> <span>'+data[0].unit+'</span></li>'+
							'<li><label>联系人电话：</label> <span>'+data[0].iPhone+'</span></li>'+
							'<li><label>邮箱：</label> <span>'+data[0].csEmail+'</span></li>'+
						'</ul>'+
					'</div>';
					var noPay='<div class="service-bar clearfix">'+
						'<ul>'+
							'<li>订单信息</li>'+
						'</ul>'+
					'</div>'+
					'<div class="main-content-mid contacts-info clearfix">'+
						'<ul>'+
							'<li><label>订单状态：</label> <span class="special">#1</span></li>'+
						'</ul>'+
					'</div>';
					/* if(data[0].status==0||data[0].status==3){
						noPay=noPay.replace("#1", "待确认"); */
					if(data[0].status==0){
						noPay=noPay.replace("#1", "预约中");
					}else if(data[0].status==1){
						noPay=noPay.replace("#1", "预约成功");
					}
					var alreadyPay='<div class="service-bar clearfix">'+
						'<ul>'+
							'<li>订单信息</li>'+
						'</ul>'+
					'</div>'+
					'<div class="main-content-mid contacts-info clearfix">'+
						'<ul>'+
							'<li><label>订单编号：</label> <span>'+data[0].number+'</span></li>'+
							'<li><label>付款时间：</label> <span>'+new Date(data[0].paymentTime).Format("yyyy-MM-dd hh:mm:ss")+'</span></li>'+
							'<li><label>支付宝交易号：</label> <span>暂无</span></li>'+
							'<li><label>订单状态：</label> <span class="special">#1</span></li>'+
						'</ul>'+
					'</div>';
					if(data[0].status==2){
						//noPay=noPay.replace("#1", "已支付");
						alreadyPay=alreadyPay.replace("#1", "待实验");
					}else if(data[0].status==3||(data[0].status == 4&&(data[0].rate==2||data[0].rate==0))){
						alreadyPay=alreadyPay.replace("#1", "已实验");
					}else if(data[0].status==4&&(data[0].rate==1||data[0].rate==3)){
						alreadyPay=alreadyPay.replace("#1", "我已评价");
					}else if(data[0].status==5){
						noPay=noPay.replace("#1", "交易关闭");
					}
					var payBtn='<div id="btnDiv" class="commentaryBtn clearfix" >'+
						'<a class="commentaryBtnB">取消订单</a>'+
						'<a class="commentaryBtnA">支付</a>'+
					'</div>';
					var completeBtn='<div id="btnDiv" class="commentaryBtn clearfix" >'+
						'<a class="commentaryBtnA">完成</a>'+
					'</div>';
					var testBtn='<div id="btnDiv" class="commentaryBtn clearfix" >'+
						'<a class="commentaryBtnA">实验</a>'+
					'</div>';
					var comment="";
					var myCommentFlag=false;
					var mngCommentFlag=false;
					for (var i=0;i<data.length;i++){
						if(data[i].comment[0]!=null){
							if(data[i].comment[0].userType=='1'){
								if(myCommentFlag==false){
									var myComment='<div class="service-bar clearfix">'+
										'<ul>'+
											'<li>评价信息</li>'+
										'</ul>'+
									'</div>'+
									'<div class="main-content-mid contacts-info clearfix">'+
										'<ul>'+
											'<li val="'+data[i].comment[0].id+'" id="myComment"><label>'+data[i].comment[0].content+'</label></li>'+
										'</ul>'+
									'</div>';
									comment=comment+myComment;
									myCommentFlag=true;
								}
							}else if(data[i].comment[0].userType=='2'){
								if(mngCommentFlag==false){
									var managerComment='<div class="service-bar clearfix">'+
										'<ul>'+
											'<li>仪器管理人员评价信息</li>'+
										'</ul>'+
									'</div>'+
									'<div class="main-content-mid contacts-info clearfix">'+
										'<ul>'+
											'<li><label>'+data[i].comment[0].content+'</label></li>'+
										'</ul>'+
									'</div>';
									comment=comment+managerComment;
									mngCommentFlag=true;
								}
							}
						}
					}
					var html=insDiv+appointDiv+contactDiv;
					if(data[0].status<2){
						html=html+noPay;
					}else{
						html=html+alreadyPay;
					}
					html=html+comment;
					if(data[0].status==1){
						$("#contentDiv").parent().append(payBtn);
					}
					else if(data[0].status==2){
						$("#contentDiv").parent().append(completeBtn);
					}
					$("#contentDiv").append(html);
					if(GetUrlByParamName("display")=="false"){
						$("#btnDiv").remove();
					} 
					$(".commentaryBtnA").click(function(){
						if($(this).text()=="完成"){
							var r=confirm("是否完成？");
							if(r==true){
								changeStatus(GetUrlByParamName("oid"),3);
							}
						}else if($(this).text()=="实验"){
							var r=confirm("是否申请实验？");
							if(r==true){
								changeStatus(GetUrlByParamName("oid"),3);
							}
						}else if($(this).text()=="支付"){
							//支付
							var r=confirm("是否支付？");
							if(r==true){
								payorder(GetUrlByParamName("oid"),2);
							}
						}
		            })
		            function payorder(){
		            	data[0].createTime = new Date(data[0].createTime).Format("yyyy-MM-dd hh:mm:ss")
		            	var orderMeg = data;
		            	orderMeg.push({"oid":GetUrlByParamName("oid")})
						var xhr = new XMLHttpRequest();
						xhr.open("POST", "/Instrument/PayApiServlet",true)
						xhr.send(JSON.stringify(data));
						xhr.onload = function(){
							if (this.status == 200) {
								window.location.href = this.response;
							}
						}
		            }
		            $.ajax({
 						url :Server + "/orderRelevant/getCommentImg",
						//url :"http://localhost/orderRelevant/getCommentImg",
						data : {
							"cid":$("#myComment").attr("val")
						},
						type : "POST",
						dataType: "JSON",
						success : function(data) {
							for(i=0;i<data.length;i++){
								$("#myComment").append("<img src="+data[i].imgPath+">");
							} 
						},
					});	
		            $.ajax({
 						url :Server + "/orderRelevant/appointmentOrderTime",
						//url :"http://localhost/share_ins/orderRelevant/appointmentOrderTime",
						data : {
							"orderId":GetUrlByParamName("oid")
						},
						type : "POST",
						success : function(data) {
							var date = data.planStart + " 至 " + data.planEnd;
							var time = data.slotStart + ":00 - " + data.slotEnd + ":00";
							$("#date").html(date);
							$("#time").html(time);
						},error : function(data) {
							console.log("订单预约时间加载失败");
						}
					});
		            function changeStatus(id,status){
							$.ajax({
 								url :Server + "/orderRelevant/changeStatus",
								//url :"http://localhost/orderRelevant/changeStatus",
								data : {
									"id":id,
									"status":status
								},
								type : "POST",
								//dataType: "JSON",
								success : function(data) {
									if(data=="修改成功"){
										alert("操作成功");
										window.location.href="new_file3";
									}
								},
							});	
						}
		            
					$(".commentaryBtnB").click(function(){
						var r=confirm("确定要取消吗？");
						if(r==true){
							$.ajax({
								url :Server + "/orderRelevant/changeStatus",
								//url :"http://localhost/orderRelevant/changeStatus",
								data : {
									"id":GetUrlByParamName("oid"),
									"status":5
								},
								type : "POST",
								//dataType: "JSON",
								success : function(data) {
									if(data=="修改成功"){
										alert("取消成功");
										window.location.href="new_file3";
									}
							},
						});	
						}
		            })
					},
				}); 
        })

			function GetUrlByParamName(name) {
	  			 var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
	 			 var URL =  decodeURI(window.location.search);
	  			 var r = URL.substr(1).match(reg);
	 			 if(r!=null){
	 		        //decodeURI() 函数可对 encodeURI() 函数编码过的 URI 进行解码
	 		         return decodeURI(r[2]);
	  			 };
	  		     return null;
	 		};
			
			Date.prototype.Format = function(fmt){
				var o = {
					"M+": this.getMonth() + 1, //月份 
	       			"d+": this.getDate(), //日 
	        		"h+": this.getHours(), //小时 
	        		"m+": this.getMinutes(), //分 
	        		"s+": this.getSeconds(), //秒 
	        		"q+": Math.floor((this.getMonth() + 3) / 3), //季度 
	        		"S": this.getMilliseconds() //毫秒 
				};
				if(/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
				for(var k in o)
				if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
	    		return fmt;
			}
	</script>
</body>

</html>